export const IsDefine = value => {
    if (
      value == null ||
      value === '' ||
      value === 'undefined' ||
      value === undefined ||
      value === 'null' ||
      value === '(null)' ||
      value === 'NULL' ||
      typeof value === 'undefined'
    ) {
      return false;
    } else {
      value = value + '';
      value = value.replace(/\s/g, '');
      if (value === '') {
        return false;
      }
      return true;
    }
  };
  export function parseTime(d) {
    if (!IsDefine(d)) {
      return '';
    }
    if (typeof d==='string') {
      return d;
    }
    var month = '',
      date = '',
      hours = '',
      minutes = '',
      seconds = '';
    if (d.getMonth() + 1 < 10) {
      month = '0' + (d.getMonth() + 1);
    } else {
      month = d.getMonth() + 1;
    }
    if (d.getDate() < 10) {
      date = '0' + d.getDate();
    } else {
      date = d.getDate();
    }
    if (d.getHours() < 10) {
      hours = '0' + d.getHours();
    } else {
      hours = d.getHours();
    }
    if (d.getMinutes() < 10) {
      minutes = '0' + d.getMinutes();
    } else {
      minutes = d.getMinutes();
    }
    if (d.getSeconds() < 10) {
      seconds = '0' + d.getSeconds();
    } else {
      seconds = d.getSeconds();
    }
    // const newDate = d.getFullYear() + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds;
    const newDate = d.getFullYear() + '-' + month + '-' + date + ' ' + hours + ':' + minutes;
    // const newDate = d.getFullYear() + '-' + month + '-' + date ;
    return newDate;
  }